import 'package:flutter/material.dart';
import 'package:flutter_hx/services/app_theme_services.dart';
import 'package:flutter_hx/services/user_service.dart';
import 'package:flutter_hx/widgets/user_avatar_widget.dart';
import 'package:get/get.dart';

import 'setting_logic.dart';

class SettingPage extends GetView<SettingLogic> {
  const SettingPage({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    final labelStyle = AppThemeServices.textTheme.h14.copyWith(
        color: AppThemeServices.appColors.primarilyTextColor,
        fontWeight: FontWeight.w500);
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Colors.white,
        elevation: 0,
        automaticallyImplyLeading: true,
        iconTheme: const IconThemeData(color: Colors.black),
        centerTitle: true,
        title: Text("设置", style: AppThemeServices.textTheme.appBarTitle),
      ),
      body: Column(
        children: [
          Container(
              color: Colors.white,
              height: 68,
              padding: const EdgeInsets.symmetric(horizontal: 10),
              child: Row(
                mainAxisAlignment: MainAxisAlignment.spaceBetween,
                children: [
                  Text("头像", style: labelStyle),
                  UserAvatarWidget(
                      size: 48,
                      avatar: UserService.to.user.value?.portrait ?? "")
                ],
              )),
          Container(
              height: 48,
              padding: const EdgeInsets.symmetric(horizontal: 10),
              color: Colors.white,
              child: Row(
                mainAxisAlignment: MainAxisAlignment.spaceBetween,
                children: [
                  Text("昵称", style: labelStyle),
                  Row(
                    children: [
                      Text("橘子君",
                          style: AppThemeServices.textTheme.h13.copyWith(
                              color: AppThemeServices.appColors.hintTextColor)),
                      const SizedBox(width: 5),
                      Icon(Icons.arrow_forward_ios_rounded,
                          size: 13,
                          color: AppThemeServices.appColors.hintTextColor)
                    ],
                  )
                ],
              )),
          const SizedBox(height: 10),
          Container(
            padding: const EdgeInsets.symmetric(horizontal: 10),
            decoration: BoxDecoration(
                color: Colors.white, borderRadius: BorderRadius.circular(7.5)),
            child: Column(
              children: [
                InkWell(
                  onTap: () => controller.toPayPassword(),
                  child: SizedBox(
                      height: 48,
                      child: Row(
                        mainAxisAlignment: MainAxisAlignment.spaceBetween,
                        children: [
                          Text("支付密码", style: labelStyle),
                          Icon(Icons.arrow_forward_ios_rounded,
                              size: 13,
                              color: AppThemeServices.appColors.hintTextColor)
                        ],
                      )),
                ),
                Divider(height: 0.5, color: AppThemeServices.appColors.divider),
                SizedBox(
                    height: 48,
                    child: Row(
                      mainAxisAlignment: MainAxisAlignment.spaceBetween,
                      children: [
                        Text("意见反馈", style: labelStyle),
                        Icon(Icons.arrow_forward_ios_rounded,
                            size: 13,
                            color: AppThemeServices.appColors.hintTextColor)
                      ],
                    )),
                Divider(height: 0.5, color: AppThemeServices.appColors.divider),
                SizedBox(
                    height: 48,
                    child: Row(
                      mainAxisAlignment: MainAxisAlignment.spaceBetween,
                      children: [
                        Text("清除缓存", style: labelStyle),
                        Row(
                          children: [
                            Text("4M",
                                style: AppThemeServices.textTheme.h13.copyWith(
                                    color: AppThemeServices
                                        .appColors.hintTextColor)),
                            const SizedBox(width: 5),
                            Icon(Icons.arrow_forward_ios_rounded,
                                size: 13,
                                color: AppThemeServices.appColors.hintTextColor)
                          ],
                        )
                      ],
                    )),
              ],
            ),
          ),
          const SizedBox(height: 15),
          Container(
            decoration: BoxDecoration(
                color: Colors.white, borderRadius: BorderRadius.circular(7.5)),
          )
        ],
      ),
    );
  }
}
